Microsoft DirectX 8.1 (C++)

DVApp Sample

Description

Digital Video (DV) capture application.

This sample demonstrates how to build various types of filter graphs for controlling DV camcorders. It also shows how to perform capture, preview, transmit, and device control with a DV camcorder.

Path

Source: (SDK root)\Samples\Multimedia\DirectShow\Capture\DVApp

Executable: (SDK root)\Samples\Multimedia\DirectShow\Bin\DVApp.exe

User's Guide

The DVApp application supports the following modes:

The capture and transmit modes also perform preview. Each of those modes has a No Preview option as well, which disables preview. Capturing without preview is more efficient and can reduce the number of dropped frames.

The application starts in preview mode. To select another mode, choose a mode from the Graph Mode menu. For each mode, DVApp builds a filter graph that supports the functionality of that mode. To save the graph as a GraphEdit (.grf) file, select Save Graph to File from the File menu. Quit DVApp before opening the file in GraphEdit.

To capture to a file:

  1. From the Graph Mode menu, select a DV to File mode (type 1 or type 2, with or without preview).
  2. From the File menu, choose Set Output File and enter a file name.
  3. Click Record.
  4. If the camcorder is in VTR mode, click Play.
  5. To stop capturing, click Stop.

To transmit from a file to the camcorder:

  1. From the Graph Mode menu, select a File to DV mode (type 1 or type 2, with or without preview).
  2. From the File menu, click Set Input File and select a DV file. The file must match the selected mode (type 1 or type 2).
  3. Click Play.
  4. To record the data to tape, click Record.
  5. To stop transmitting, click Stop.

If the camcorder is in VTR mode, the user can control the transport mechanism through the application's VCR-style buttons. To seek the tape, enter the target timecode and click the seek button.

To limit how much data the application captures, choose Capture Size from the File menu.

To check the tape format (NTSC or PAL), choose Check Tape from the Options menu.

To change the size of the preview window, choose Change Decode Size from the Options menu.

Programming Notes

The main purpose of this application is to show how to build various DV capture and transmit graphs.

Device Arrival and Removal

The application handles device arrival and removal, using two different techniques. For device arrival, the application's message loop responds to WM_DEVICECHANGE messages. For device removal, the application responds to EC_DEVICE_LOST events from the filter graph manager. Either approach works, although the EC_DEVICE_LOST event depends on the existence of the device in the filter graph.

The application only handles one device at a time. If the current device is removed, the application looks for another DV device on the system.

On some DV camcorders, the user must shut off the device when switching it between camera mode and VTR mode, which triggers a device-lost message. The application responds by enabling or disabling the appropriate menu commands. However, if the user toggles rapidly between modes, the camcorder might not generate a device-lost message. You can force the menus to update by choosing Refresh Mode from the Options menu. Some DV camcorders can toggle modes without shutting off, but send a device-lost message only when they switch to VTR mode.

Note   Microsoft Windows NT 4.0 and earlier do not support the data types used for device arrival. In order to compile the application for these platforms, the data types are conditionally included if WINVER is less than 0x500. However, the application does not support device detection on those platforms.

Device Control

The functionality of the application's Play and Record button depends on the current mode:

The sample application does not perform frame-accurate capture. At various points, the application calls the Sleep function to wait for the device to respond. Newer DV camcorders send a notification when the state of the device changes. Older devices might not support notification; for the purposes of a sample, calling Sleep is a simpler solution.

See Also